package com.example.pengpeng.login;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;


public class Login extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        final EditText UserName = (EditText)findViewById(R.id.editText1);
        final EditText Password = (EditText)findViewById(R.id.editText2);
        final EditText ConfirmPassword = (EditText)findViewById(R.id.editText3);
        final EditText Mail = (EditText)findViewById(R.id.editText4);
        final EditText Name = (EditText)findViewById(R.id.editText5);
        final EditText Gender = (EditText)findViewById(R.id.editText6);
        final EditText Tel = (EditText)findViewById(R.id.editText7);
        Button button = (Button)findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(UserName.getText().toString().equals("") || Password.getText().toString().equals("")
                        || ConfirmPassword.getText().toString().equals("") || Mail.getText().toString().equals("")
                         || Name.getText().toString().equals("") || Gender.getText().toString().equals("")
                         || Tel.getText().toString().equals("")){

                    Toast t = Toast.makeText(Login.this, "输入为空！", Toast.LENGTH_LONG);
                    t .show();
                }
                else{
                    Intent intent1 = new Intent(Login.this, LoginSuccess.class);
                    startActivity(intent1);
                }
            }
        });
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.login, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
